package com.fh.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
/**
 * @Author : whf
 * @CreateTime : 2020/3/21
 * @Description :
 **/
@Configuration
public class ResourceConfig implements WebMvcConfigurer {
    @Value("${utils.picture.address}")
    private String address;
    @Value("${utils.picture.pictureAddress}")
    private String pictureAddress;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String path = System.getProperty("user.dir") + address + "static" + pictureAddress;
        //配置静态资源访问路径
        registry.addResourceHandler("/image/headpicture/**").
                addResourceLocations("file:"+path);
    }
}